package com.hsbc.ins.ips.hello;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.io.IOUtils;

public class HelloHDFS {
	public static void main(String[] args) throws IOException {
		//one way to access hdfs file system
		URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
		URL url = new URL("hdfs://centos6-1:8020/hello.txt");
		InputStream in = url.openStream();
		IOUtils.copyBytes(in, System.out,4096,true );
	}
}
